package com.hbhmzy.contact;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;


public class ContactDBHelper extends SQLiteOpenHelper {

	public ContactDBHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// 第一次使用数据库时自动建表
		String CREATE_CONTACT_SQL = "CREATE TABLE IF NOT EXISTS contact_info(_id integer primary key autoincrement ,"
				+ "name varchar(255) ,"
				+ "number varchar(255),"
				+ "sortkey varchar(255),"
				+ "email varchar(255),"
				+ "address varchar(255))";
		db.execSQL(CREATE_CONTACT_SQL);
		Log.i("---db create---", "true");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.i("---onUpdate Called---", oldVersion + "--->" + newVersion);
	}

}
